package org.breathe.dynamic.thread.pool.example.controller;

import org.breathe.dynamic.thread.pool.core.executor.ThreadPoolExecutorRegistry;
import org.breathe.dynamic.thread.pool.core.thread.BreatheDtpExecutor;
import org.breathe.thread.pool.common.entity.ThreadPoolExecutorProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Scanner;

/**
 * @author: breathe
 * @createTime: 2025-04-14
 */
@RestController
public class TestController {

    @GetMapping("/refresh")
    public String test() {
        Scanner scan = new Scanner(System.in);
        BreatheDtpExecutor executor = ThreadPoolExecutorRegistry.get("dtp1");
        ThreadPoolExecutorProperties threadPoolExecutorProperties = new ThreadPoolExecutorProperties();
        threadPoolExecutorProperties.setMaximumPoolSize(20);
        ThreadPoolExecutorRegistry.refresh(executor, threadPoolExecutorProperties);
        return "ok";
    }
}
